<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Installing Java</title>
<link rel="stylesheet" href="/cfg/format.css" type="text/css">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta name="keywords" content="jee tutorial, Java, web applications, install java">
<meta name="description" content="This part of the Java EE 5 tutorials covers the innstallation of Java.">
<meta name="language" content="en">
<meta name="author" content="Jan Bodnar">
<meta name="distribution" content="global">

<script type="text/javascript" src="/lib/jquery.js"></script>
<script type="text/javascript" src="/lib/common.js"></script>

</head>

<body>

<div class="container">

<div id="wide_ad" class="ltow">
<script type="text/javascript"><!--
google_ad_client = "pub-9706709751191532";
/* 160x600, August 2011 */
google_ad_slot = "2484182563";
google_ad_width = 160;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</div>


<div class="content">


<a href="/" title="Home">Home</a>&nbsp;&nbsp;
<a href=".." title="Contents">Contents</a>



<h1>Installing Java</h1>


<p>
In this part of the jee tutorial series,  we will install the <b>Java Development Kit</b> (JDK). 
The JDK is a software development kit used to create Java applications. If we need to run Java 
applications, we only need the <b>Java Runtime Environment</b> (JRE). If we want to create 
Java applications, we also need the JDK. The JDK also includes JRE. Primary components of the 
Java Development Kit are Java compiler, laucher, documentation generator, debugger, dissasebler, archiver.
</p>

<div class="center"> 
<script type="text/javascript"><!--
google_ad_client = "pub-9706709751191532";
/* horizontal */
google_ad_slot = "1734478269";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script> 
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> 
</script> 
</div> 

<p>
There are three basic Java editions. 
</p>

<ul>
<li>Java SE - Java Standard Edition</li>
<li>Java EE - Java Enterprise Edition</li>
<li>Java ME - Java Micro Edition</li>
</ul>

<p>
If we download the JDK we can create Java SE applications. These are basically 
command line applications a Java Swing GUI 
applications. Java EE is used to create enterprise applications. The Java ME is 
used to create mobile applications. For both of them, we need to install additional 
libraries. Java EE is the target of our tutorials. 
</p>


<h2>Steps</h2>

<p>
These are the steps to install the latest JDK on Linux. When I write 
these words it is JDK 6 Update 3.
</p>

<ol>
<li>go to http://java.sun.com/</li>
<li>select menu downloads - Java SE</li>
<li>click on the download button of the latest JDK version</li>
<li>accept licence agreement</li>
<li>download the the appropriate version of java, Linux self-extracting file, 65.40 MB</li>
<li>sudo chmod +x jdk-6u3-linux-i586.bin</li>
<li>./jdk-6u3-linux-i586.bin</li>

<li>
Do you agree to the above license terms? [yes or no] yes
</li>
<li>mv jdk1.6.0_03/ installdir</li>

</ol>

<pre class="code">
$ export PATH=$PATH:/home/vronskij/bin/jdk1.6.0_03/bin/
</pre>

<p>
We add the bin directory to the PATH variable. On my computer the 
path to the java bin directory is 
/home/vronskij/bin/jdk1.6.0_03/bin/
</p>

<pre class="code">
$ java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
</pre>

<p>
We verify the installed version of java. Now let's create a simple java console application.
Launch your favourite text editor and write down the following code.
</p>

<pre class="code">
/* Console.java */

public class Console {

    public static void main(String[] args) {
        System.out.println("Java console application");
    }

}
</pre>

<p>
This sample program will print text on the console window.
</p>

<pre class="code">
$ javac Console.java
$ ls
Console.class  Console.java  Console.java~
$ java Console
Java console application
</pre>

<p>
We compile the source code with the javac command. Then we lauch the 
program with the java command.
</p>

<pre class="code">
export JAVA_HOME=/home/vronskij/bin/jdk1.6.0_03/bin/
</pre>

<p>
We set up the <b>JAVA_HOME</b> variable to point to our JDK. 
This is for other applications like ant or
Netbeans, so that they know, where the Java has been installed.
</p>

<p>
In this part of the JEE tutorial, we covered Java installation.
</p>


<div class="center"> 
<script type="text/javascript"><!--
google_ad_client = "pub-9706709751191532";
/* horizontal */
google_ad_slot = "1734478269";
google_ad_width = 468;
google_ad_height = 60;
//-->
</script> 
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> 
</script> 
</div> 
<br> 


<div class="botNav, center">
<span class="botNavItem"><a href="/">Home</a></span> ‡ <span class="botNavItem"><a href="..">Contents</a></span> ‡ 
<span class="botNavItem"><a href="#">Top of Page</a></span>
</div>

<div class="footer">
<div class="signature">
<a href="/">ZetCode</a> last modified February 11, 2008  <span class="copyright">&copy; 2007 - 2013 Jan Bodnar</span>
</div>
</div>

</div> <!-- content -->

</div> <!-- container -->

</body>
</html>


